//
//  YQOrderManageStateCell.swift
//  MuYing
//
//  Created by tbb on 2019/8/1.
//  Copyright © 2019 TBB. All rights reserved.
//

import UIKit

class YQOrderManageStateCell: YQTableViewBaseCell {

    @objc var orderModel = YQPOrderEntityModel()
    @IBOutlet weak var stateIcon: UIImageView!
    @IBOutlet weak var titleLb: UILabel!
    /**
    * 订单状态：101->订单生成，未支付 ；102->下单后未支付用户取消；103->下单后未支付，超时系统取消；104, 支付失败
    * 201->支付完成，待发货；202->付款未发货，退款取消；301->已发货，未确认收货；302->用户确认收货；303->系统自动确认收货
    */
    @objc var orderStatus:Int = 0 {
        didSet {
            switch self.orderStatus {
            case 101:
                self.stateLb.text = kYQLSSwift("等待买家付款");
                break
            case 102:
            self.stateLb.text = kYQLSSwift("超时用户取消");
                break
            case 103:
            self.stateLb.text = kYQLSSwift("超时系统取消");
                break
            case 104:
            self.stateLb.text = kYQLSSwift("支付失败");
                break
            case 202:
                self.stateLb.text = kYQLSSwift("取消订单");
                break
            case 201:
                self.stateLb.text = kYQLSSwift("等待卖家发货");
                break
            case 301://已发货，未确认收货
                self.stateLb.text = kYQLSSwift("卖家已发货");
                break
            case 302,303:
                self.stateLb.text = kYQLSSwift("交易成功");
                break
            default: break
                
            }
        }
    }
    
    @objc @IBOutlet weak var stateLb: UILabel!
    override func awakeFromNib() {
        super.awakeFromNib()
        titleLb.text = kYQLSSwift("订单状态")
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        
    }
    
    @objc func setModel(_ model:YQPOrderEntityModel){
        let status = model.orderStatus
        
        if status == "0" {//待付积分
            self.stateLb.text = kYQLSSwift("等待买家付款");
        } else if status == "1" {//待发货
            self.stateLb.text = kYQLSSwift("等待卖家发货");

        } else if status == "2" {//待收货
            self.stateLb.text = kYQLSSwift("等待买家收货");

        } else if status == "3" {//待评价
            self.stateLb.text = kYQLSSwift("已收货");

        } else if status == "4" {//已关闭
            self.stateLb.text = kYQLSSwift("已关闭");

        }
        self.orderModel = model
    }
    
}

